package com.lingyu.jsjx.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lingyu.jsjx.mapper.TeachingResearchMapper;
import com.lingyu.jsjx.domain.TeachingResearch;
import com.lingyu.jsjx.service.ITeachingResearchService;

/**
 * 教研管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@Service
public class TeachingResearchServiceImpl  extends ServiceImpl<TeachingResearchMapper, TeachingResearch> implements ITeachingResearchService
{
    @Autowired
    private TeachingResearchMapper teachingResearchMapper;

    /**
     * 查询教研管理
     * 
     * @param researchId 教研管理主键
     * @return 教研管理
     */
    @Override
    public TeachingResearch selectTeachingResearchByResearchId(Long researchId)
    {
        return teachingResearchMapper.selectTeachingResearchByResearchId(researchId);
    }

    /**
     * 查询教研管理列表
     * 
     * @param teachingResearch 教研管理
     * @return 教研管理
     */
    @Override
    @DataScope(deptAlias = "u", userAlias = "tr",type = "jsjx")
    public List<TeachingResearch> selectTeachingResearchList(TeachingResearch teachingResearch)
    {
        return teachingResearchMapper.selectTeachingResearchList(teachingResearch);
    }

    /**
     * 新增教研管理
     * 
     * @param teachingResearch 教研管理
     * @return 结果
     */
    @Override
    public int insertTeachingResearch(TeachingResearch teachingResearch)
    {
        return baseMapper.insert(teachingResearch);
    }

    /**
     * 修改教研管理
     * 
     * @param teachingResearch 教研管理
     * @return 结果
     */
    @Override
    public int updateTeachingResearch(TeachingResearch teachingResearch)
    {

        return baseMapper.updateById(teachingResearch);
    }

    /**
     * 批量删除教研管理
     * 
     * @param researchIds 需要删除的教研管理主键
     * @return 结果
     */
    @Override
    public int deleteTeachingResearchByResearchIds(Long[] researchIds)
    {
        return teachingResearchMapper.deleteTeachingResearchByResearchIds(researchIds);
    }

    /**
     * 删除教研管理信息
     * 
     * @param researchId 教研管理主键
     * @return 结果
     */
    @Override
    public int deleteTeachingResearchByResearchId(Long researchId)
    {
        return baseMapper.deleteById(researchId);
    }

    @Override
    public List<Map<String, Object>> selectCountByResearchType() {
        return teachingResearchMapper.selectCountByResearchType();
    }

    /**
     * 统计教研类型（进行中、已完成）
     * @return
     */
    @Override
    public List<Map<String, Object>> selectResearchTypeCount() {
        return teachingResearchMapper.selectResearchTypeCount();
    }
}
